package z.t.b.db.meta;

import java.sql.SQLException;
import java.util.List;

/**
 * 元数据加载器
 */
public interface MetadataLoader {

    /**
     * 加载库中的表
     * @param db
     * @return
     */
    List<Table> loadTablesFromDB(DB db) throws SQLException;

    Table loadTableFromDB(DB db, String tableName) throws SQLException;

    /**
     * 加载表列
     * @param table
     * @throws SQLException
     */
    List<Column> loadColumnsByTable(Table table) throws SQLException;

    /**
     * 加载主键
     * @param table
     * @throws SQLException
     */
    List<Index> loadKeysByTable(Table table) throws SQLException;

    /**
     * 建表语句
     * @param table
     * @throws SQLException
     */
    String getCreateDDL(Table table) throws SQLException;

    /**
     *
     * @param table
     * @return
     * @throws SQLException
     */
    String getTableCreateDDL(Table table) throws SQLException;

    /**
     *
     * @param table
     * @return
     * @throws SQLException
     */
    String getViewCreateDDL(Table table) throws SQLException;
}
